import {createRouter, createWebHashHistory } from 'vue-router'
 // 导入nprogress
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'

// 路由数组
const routes = [
    // {
    //     path:'/login',
    //     name:'Login',
    //     component:'../views/LoginName.vue'
    // },
    {
        path:'/login',
        component:()=>import('../views/LoginName.vue')
    }
]

// 路由器对象
const router = createRouter({
    history: createWebHashHistory(),
    routes
})


// 路由导航守卫
router.beforeEach((to,from,next) => {
    NProgress.start() // 开启加载进度条
    next()
})
router.afterEach(() => {
    NProgress.done() // 结束加载进度条
})

export default router